﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using TSB.FarmPowerShellWizard.Entities;

namespace TSB.FarmPowerShellWizard.Repository
{
    /*
     *  This class is currently in progress 
     */
    public class ContentTypeRepository
    {
        public List<ContentType> GetContentTypes(SPWeb web)
        {
            if (web == null)
            {
                return new List<ContentType>();
            }

            var contentTypes = new List<ContentType>();

            foreach(SPContentType ct in web.ContentTypes)
            {
                contentTypes.Add(new ContentType
                                     {
                                         //Id = ct.Id,
                                         Name =  ct.Name
                                     });
            }

            return contentTypes.OrderBy(x => x.Name).ToList();
        }

        public void GetFields(SPWeb web, string ctName)
        {
            var ct = web.ContentTypes[ctName];
        }

        public string GetPowerShell(SPWeb web, string ctName)
        {
            return string.Empty;
        }
    }
}
